//  
//  BGOEventParameter.m
//  Bango iOS API
//
//  Created by William Shakour on September 8, 2011.
//  Copyrights © 2011 Bango - http://www.bango.net/ - All rights reserved.
//

#import "BGOEventParameter.h"
#import "BGOEvent.h"

#import "BGOFieldNameConstants.h"

@implementation BGOEventParameter
+ (BGOEventParameter *)eventParameter {
  return [[[BGOEventParameter alloc] init] autorelease];
}
@synthesize event=_event;
@synthesize eventName=_eventName;
@synthesize eventValue=_eventValue;
- (NSMutableDictionary *) toJson {
  NSMutableDictionary * jsonObject = [super toJson];
  //  if (_event != nil) {
  //    [jsonObject setObject:_event forKey:@"Event"];
  //  }
  if (_eventName != nil) {
    [jsonObject setObject:_eventName forKey:BGO_POST_PARAMETERNAME];
  }
  if (_eventValue != nil) {
    [jsonObject setObject:_eventValue forKey:BGO_POST_PARAMETERVALUE];
  }
  return jsonObject;
}
- (void)fromJson:(NSDictionary *) jsonObject {
  [super fromJson:jsonObject];
  if ([jsonObject objectForKey:@"Event"] != nil) {
    _event = [[jsonObject objectForKey:@"Event"] retain];
  }
  if ([jsonObject objectForKey:BGO_POST_PARAMETERNAME] != nil) {
    self.eventName = [jsonObject objectForKey:BGO_POST_PARAMETERNAME];
  }
  if ([jsonObject objectForKey:BGO_POST_PARAMETERVALUE] != nil) {
    self.eventValue = [jsonObject objectForKey:BGO_POST_PARAMETERVALUE];
  }
  
  return;
}
- (void) dealloc {
  [_event release];
  [_eventName release];
  [_eventValue release];
  [super dealloc];
  return;
}
@end